package
{
	import caurina.transitions.Tweener;
	
	import flash.display.Sprite;
	import flash.events.TimerEvent;
	import flash.utils.ByteArray;

	public class slideMenu extends Menu
	{
		private var carsArray:Array = new Array();
		public function slideMenu()
		{
			super();
			buttonWidth=300;
		}
		public function addMany(str:String,count:int):void{
			for (var i:int = 0;i<count;i++){
				var b:CarButton = new CarButton(this);  
				b.setPosition(buttonWidth*int(i/2),200*(i%2));
				b.giveRenderSprite(r);
				b.overrideSize(buttonWidth,0);
				addChild(b);
				b.load(null,str);
				buttons.push(b);
				this.x=-buttonWidth*buttons.length/2;
			}
			start=this.x;
		}
		
		override public function show():void{
			carsArray=r.getCars();
			for (var i:int = 0;i<buttons.length;i++){
				var b:CarButton =buttons[i] as CarButton;
				if (i<carsArray.length){
					
				var c:Car = (carsArray[i] as Car);
				c.shrink(300);
				b.giveCarPos(c.gridX,c.gridY,c); 
				}
			}
			r.addChild(this);
			showing=true;
			this.y=ymove;
			Tweener.addTween(this,{x:shift+xmove,time: 1});
		}
		override public function hide():void{
			showing=false;
			Tweener.addTween(this,{x:start,time: 1});
			r.closeMenuWoosh.play();
		}
	}
}